package com.clf.tms;

import com.alibaba.druid.pool.DruidDataSource;
import com.clf.tms.listener.MyElasticJobListener;
import com.dangdang.ddframe.job.lite.api.listener.ElasticJobListener;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;

import javax.sql.DataSource;

@SpringBootApplication
public class TmsApplication {

    @Bean
    @ConfigurationProperties(prefix = "spring.datasource")
    public DataSource myDateSource() {
        return new DruidDataSource();
    }

    @Bean
    public ElasticJobListener elasticJobListener() {
        return new MyElasticJobListener();
    }

    public static void main(String[] args) {
        SpringApplication.run(TmsApplication.class, args);
    }

}

